SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
RPG

RPG static code analysis

Unique rules to find Bugs, Security Hotspots, and Code Smells in your RPG code

  • All rules 58
  • Vulnerability1
  • Bug7
  • Security Hotspot1
  • Code Smell49
 
Tags
    Impact
      Clean code attribute
        1. "GOTO" statements should not be used

           Code Smell
        2. Multiple occurrence data structures should not be used

           Code Smell
        3. Compile-time arrays should not be used

           Code Smell
        4. Optional operation codes should be omitted

           Code Smell
        5. "QUALIFIED" data structures should be used

           Code Smell
        6. Prototypes should be used

           Code Smell
        7. Comment lines should not be too long

           Code Smell
        8. "/COPY" statements should include specification letters

           Code Smell
        9. Standard language features should be in upper case

           Code Smell
        10. Subprocedures should be used instead of subroutines

           Code Smell
        11. Subprocedures should not reference global variables

           Code Smell
        12. "/EJECT" should be used after "F", "D" and "C" specification sections

           Code Smell
        13. "CONST" should be used for parameters that are not modified

           Code Smell
        14. Variables used in only one subprocedure should not be global

           Code Smell
        15. The "*srcstmt" header option should be used

           Code Smell
        16. Two branches in a conditional structure should not have exactly the same implementation

           Code Smell
        17. Unused subprocedures should be removed

           Code Smell
        18. "IF" blocks should not have too many lines of code

           Code Smell
        19. "DO" blocks should not have too many lines of code

           Code Smell
        20. The data area structure for "IN" should be defined in D spec lines.

           Code Smell
        21. "/COPY" should be avoided

           Code Smell
        22. SQL statements should not join too many tables

           Code Smell
        23. The correct "ENDxx" statement should be used

           Code Smell
        24. Track uses of disallowed operation codes

           Code Smell
        25. Indicators should be used on "CHAIN" statements

           Code Smell
        26. The first parameter of a "CHAIN/READx" statement should be a "KLIST"

           Code Smell
        27. The parameters of a "CALL" or "CALLB" statement should be defined as a "PLIST"

           Code Smell
        28. "IF" statements should not be conditioned on Indicators

           Code Smell
        29. LIKE keyword should be used to define work fields

           Code Smell
        30. Numeric fields should be defined as odd length packed fields

           Code Smell
        31. "E" should be found in F-spec lines

           Code Smell
        32. Error handling should be defined in F specs

           Code Smell
        33. Standard figurative constants *ON, *OFF and *BLANK should be used in place of '1', '0' and ' '

           Code Smell
        34. Unused subroutines should be removed

           Code Smell
        35. Subroutines should be documented

           Code Smell
        36. Subroutines should not be too complex

           Code Smell
        37. Columns to be read with a "SELECT" statement should be clearly defined

           Code Smell
        38. Track lack of copyright and license headers

           Code Smell
        39. Subroutines should not have too many lines of code

           Code Smell
        40. Control flow statements "IF", "FOR", "DO", ... should not be nested too deeply

           Code Smell
        41. "IF ... ELSEIF" constructs should end with "ELSE" clauses

           Code Smell
        42. Sections of code should not be commented out

           Code Smell
        43. String literals should not be duplicated

           Code Smell
        44. "SELECT WHEN" clauses should not have too many lines of code

           Code Smell
        45. Nested blocks of code should not be left empty

           Code Smell
        46. Unused variables should be removed

           Code Smell
        47. Expressions should not be too complex

           Code Smell
        48. Files should not have too many lines of code

           Code Smell
        49. Subroutine names should comply with a naming convention

           Code Smell

        The "*srcstmt" header option should be used

        intentionality - complete
        maintainability
        Code Smell
        • confusing
        • error-reporting

        Why is this an issue?

        Turning on the *srcstmt header option means that any line numbers cited in error statements will actually correspond correctly to the code. Otherwise, object line numbers will be shown, making errors difficult to debug.

        The *srcstmt option is also recommended for accurate line numbers during debugging, particularly in combination with *nodebugio, (H option(*srcstmt:*nodebugio)) which prevents debug operations from stopping on I/O.

        Noncompliant code example

        H*
        H* AMENDED BY : G. Ann Campbell
        H* DATE       : 16JUL2014
        H* H24 - Miscellaneous Online Maintenance/Enquiry/Printing
        H*
        F/EJECT
        

        Compliant solution

        H*
        H* AMENDED BY : G. Ann Campbell
        H* DATE       : 16JUL2014
        H* H24 - Miscellaneous Online Maintenance/Enquiry/Printing
        H*
        H option(*srcstmt)
        F/EJECT
        
          Available In:
        • SonarQube IdeCatch issues on the fly,
          in your IDE
        • SonarQube ServerAnalyze code in your
          on-premise CI
          Enterprise
          Edition
          Available Since
          9.1

        © 2008-2025 SonarSource SA. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use